package com.yfp.tissue.api.factory;

import com.yfp.common.core.domain.R;
import com.yfp.tissue.api.RemoteCompanyService;
import com.yfp.tissue.domain.Company;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 *
 * @version 1.0
 * @date 2024-08-13 15:51
 */
@Component
public class RemoteCompanyFallbackFactory implements FallbackFactory<RemoteCompanyService> {
    @Override
    public RemoteCompanyService create(Throwable cause) {
        return new RemoteCompanyService(){


            @Override
            public R add(Company company) {
                return R.fail("新增公司失败:" + cause.getMessage());
            }

            @Override
            public R updateCompany(Company company) {
                return R.fail("编辑公司失败:" + cause.getMessage());
            }

            @Override
            public R<Company> findByCompanyAccount(String companyAccount) {
                return R.fail("获取公司失败:" + cause.getMessage());
            }

            @Override
            public R<Void> del(String id, String source) {
                return R.fail("删除公司失败:" + cause.getMessage());
            }

        };



    }
}
